﻿using Collection.Export.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Collection.Export.Services.Wanpijie
{
    public abstract class Service<T> : IImportService<T> where T : class
    {
        public event Action<T> Insert;

        public event Action<T> Update;

        public abstract T Import(T obj);

        protected void OnInsert(T obj)
        {
            if (this.Insert != null)
            {
                this.Insert(obj);
            }
        }

        protected void OnUpdate(T obj)
        {
            if (this.Update != null)
            {
                this.Update(obj);
            }
        }
    }
}
